home *** CD-ROM | disk | FTP | other *** search
- /*
- File: SampleStorageHeader.c
-
- Contains: All exported structures and functions for the USB Manager
-
- Version: 1.1
-
- Copyright: © 1998-1999 by Apple Computer, Inc., all rights reserved.
-
- */
-
-
-
- #include <MacTypes.h>
- #include <Devices.h>
- #include <DriverServices.h>
- #include <USB.h>
-
- #include "SampleStorageDriver.h"
- #include "SampleStorageVersion.h"
- #include "SampleStorageDeviceID.h"
-
- //------------------------------------------------------
- //
- // Protos
- //
- //------------------------------------------------------
- OSStatus StorageDriverValidateHW(USBDeviceRef device, USBDeviceDescriptor *desc);
- OSStatus StorageDriverInitDevice(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
- OSStatus StorageDriverInitInterface( UInt32 interfaceNum, USBInterfaceDescriptor *interfaceDesc, USBDeviceDescriptor *deviceDesc, USBDeviceRef device);
- OSStatus StorageDriverFinalize(USBDeviceRef device, USBDeviceDescriptorPtr desc );
- OSStatus StorageDriverNotifyProc(UInt32 notification, void *pointer, UInt32 refCon);
-
- //------------------------------------------------------
- //
- // This is the driver description structure that the expert looks for first.
- // If it's here, the information within is used to match the driver
- // to the device whose descriptor was passed to the expert.
- // Information in this block is also used by the expert when an
- // entry is created in the Name Registry.
- //
- //------------------------------------------------------
- USBDriverDescription TheUSBDriverDescription =
- {
- // Signature info
- kTheUSBDriverDescriptionSignature, // 'usbd'
- kInitialUSBDriverDescriptor, // 0
-
- // Device Info
- kDriverVendorID, // USB Vendor ID
- kDriverProductID, // USB Product ID.
- 0, // Release Number of Device
- 0, // Protocol Info.
-
- // Interface Info (* I don't think this would always be required...*)
- 0, // Configuration Value
- 0, // Interface Number
- kDriverClassID, // Interface Class (from USBDeviceDefines.h)
- kDriverSubClassID, // Interface SubClass (from USBDeviceDefines.h)
- 0, // Interface Protocol
-
-
- // Driver Info
- "\pUSB Storage Class", // Driver name for Name Registry
- kDriverClassID, // Device Class (from USBDeviceDefines.h)
- kDriverSubClassID, // Device Subclass (from USBDeviceDefines.h)
- kStorageHexMajorVers, kStorageHexMinorVers, kStorageReleaseStage, kStorageCurrentRelease, // version of driver = 0.0d0
-
- // Driver Loading Info
- kUSBDoNotMatchGenericDevice | /* Driver's VendorID must match Device's VendorID*/
- //kUSBDoNotMatchInterface | /* Do not load this driver as an interface driver.*/
- //kUSBProtocolMustMatch | /* Do not load this driver if protocol field doesn't match.*/
- //kUSBInterfaceMatchOnly | /* Only load this driver as an interface driver.*/
- 0 // To end the Driver Loading flags field
- };
-
- USBClassDriverPluginDispatchTable TheClassDriverPluginDispatchTable =
- {
- kClassDriverPluginVersion, // Version of this structure
- StorageDriverValidateHW, // Hardware Validation Procedure
- StorageDriverInitDevice, // Initialization Procedure
- StorageDriverInitInterface, // Interface Initialization Procedure
- StorageDriverFinalize, // Finalization Procedure
- StorageDriverNotifyProc, // Driver Notification Procedure
- };
-
- // Hardware Validation
- // Called upon load by Expert
- OSStatus
- StorageDriverValidateHW( USBDeviceRef device,
- USBDeviceDescriptor *desc)
- {
- device = 0;
- desc = 0;
- return (OSStatus)noErr;
- }
-
-
- // Initialization function
- // Called upon load by Expert
- OSStatus
- StorageDriverInitDevice( USBDeviceRef device,
- USBDeviceDescriptorPtr pDesc,
- UInt32 busPowerAvailable)
- {
- busPowerAvailable = 0;
-
- StorageDriverEntry(device, pDesc, NULL );
-
- return (OSStatus)noErr;
- }
-
- // StorageDriverInitInterface function
- // Called to initialize driver for an individual interface - either by expert or
- // internally by driver
- OSStatus
- StorageDriverInitInterface( UInt32 interfaceNum,
- USBInterfaceDescriptor *interfaceDesc,
- USBDeviceDescriptor *deviceDesc,
- USBDeviceRef device)
- {
- interfaceNum = 0;
-
- StorageDriverEntry(device, deviceDesc, interfaceDesc );
-
- return (OSStatus)noErr;
- }
-
- // Termination function
- // Called by Expert when driver is being shut down
- OSStatus
- StorageDriverFinalize( USBDeviceRef device,
- USBDeviceDescriptorPtr desc )
- {
- #pragma unused(device)
- #pragma unused(desc)
-
- StorageClassDriverFinalize();
-
- return (OSStatus)noErr;
- }
-
- OSStatus
- StorageDriverNotifyProc(UInt32 notification,
- void* pointer,
- UInt32 refCon)
- {
- #pragma unused(refCon)
-
- return(StorageClassDriverNotifyProc(notification, pointer));
- }
-